<?php
declare(strict_types=1);
namespace Field;

class StoreOrderConst
{
    public const pk='';
    public const index=['OrderID'];
	public const fields=['OrderID','UserID','UseMoney','UseRmbs','Price','CreateAt','PayConfID','PayBillID','IsPay','PayAt','PayType','Status','IsSettle','UpdateAt','channel','IsShow','CreateYmd','PayYmd','ParentUserID','IsRefund','NickID','ProductID','TimeOut'];
	public const comment=['OrderID'=>'订单号','UserID'=>'用户id','UseMoney'=>'使用现金','UseRmbs'=>'使用余额','Price'=>'授权周期','CreateAt'=>'创建时间','PayConfID'=>'支付渠道','PayBillID'=>'支付流水ID','IsPay'=>'已支付','PayAt'=>'支付时间','PayType'=>'支付方式 10 jsapi, 20 minapppay , 40 alipay','Status'=>'订单状态 0:待付款,10:待发货,20:待收货,30:待评价,40:完成,50:售后,60:取消','IsSettle'=>'是否生成结算','UpdateAt'=>'更新时间','channel'=>'订单类型 10 H5,20公众号,30小程序','IsShow'=>'用户是否删除','CreateYmd'=>'创建年月日','PayYmd'=>'支付年月日','ParentUserID'=>'推荐人','IsRefund'=>'是否有退款','NickID'=>'','ProductID'=>'','TimeOut'=>''];
	/*
    * @Field OrderID
    * @Type char(20)
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key PRI
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 订单号
    */
    public const OrderID = 'OrderID';
    /*
    * @Field UserID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 用户id
    */
    public const UserID = 'UserID';
    /*
    * @Field UseMoney
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 使用现金
    */
    public const UseMoney = 'UseMoney';
    /*
    * @Field UseRmbs
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 使用余额
    */
    public const UseRmbs = 'UseRmbs';
    /*
    * @Field Price
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 授权周期
    */
    public const Price = 'Price';
    /*
    * @Field CreateAt
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 创建时间
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field PayConfID
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 支付渠道
    */
    public const PayConfID = 'PayConfID';
    /*
    * @Field PayBillID
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 支付流水ID
    */
    public const PayBillID = 'PayBillID';
    /*
    * @Field IsPay
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 已支付
    */
    public const IsPay = 'IsPay';
    /*
    * @Field PayAt
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 支付时间
    */
    public const PayAt = 'PayAt';
    /*
    * @Field PayType
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 支付方式 10 jsapi, 20 minapppay , 40 alipay
    */
    public const PayType = 'PayType';
    /*
    * @Field Status
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 订单状态 0:待付款,10:待发货,20:待收货,30:待评价,40:完成,50:售后,60:取消
    */
    public const Status = 'Status';
    /*
    * @Field IsSettle
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 是否生成结算
    */
    public const IsSettle = 'IsSettle';
    /*
    * @Field UpdateAt
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 更新时间
    */
    public const UpdateAt = 'UpdateAt';
    /*
    * @Field channel
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 订单类型 10 H5,20公众号,30小程序
    */
    public const channel = 'channel';
    /*
    * @Field IsShow
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 1
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 用户是否删除
    */
    public const IsShow = 'IsShow';
    /*
    * @Field CreateYmd
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 创建年月日
    */
    public const CreateYmd = 'CreateYmd';
    /*
    * @Field PayYmd
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 支付年月日
    */
    public const PayYmd = 'PayYmd';
    /*
    * @Field ParentUserID
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 推荐人
    */
    public const ParentUserID = 'ParentUserID';
    /*
    * @Field IsRefund
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 是否有退款
    */
    public const IsRefund = 'IsRefund';
    /*
    * @Field NickID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const NickID = 'NickID';
    /*
    * @Field ProductID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const ProductID = 'ProductID';
    /*
    * @Field TimeOut
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const TimeOut = 'TimeOut';
}

class StoreOrderColumns
{
public  string $OrderID;
   public  int $UserID;
   public  int $UseMoney=0;
   public  int $UseRmbs=0;
   public  int $Price=0;
   public  int $CreateAt=0;
   public  int $PayConfID=0;
   public  int $PayBillID=0;
   public  int $IsPay=0;
   public  int $PayAt=0;
   public  int $PayType=0;
   public  int $Status=0;
   public  int $IsSettle=0;
   public  int $UpdateAt=0;
   public  int $channel=0;
   public  int $IsShow=0;
   public  int $CreateYmd=0;
   public  int $PayYmd=0;
   public  int $ParentUserID=0;
   public  int $IsRefund=0;
   public  int $NickID=0;
   public  int $ProductID=0;
   public  int $TimeOut=0;
	public function toArray():array
	{
		return [
'OrderID'=>$this->OrderID,
    'UserID'=>$this->UserID,
    'UseMoney'=>$this->UseMoney,
    'UseRmbs'=>$this->UseRmbs,
    'Price'=>$this->Price,
    'CreateAt'=>$this->CreateAt,
    'PayConfID'=>$this->PayConfID,
    'PayBillID'=>$this->PayBillID,
    'IsPay'=>$this->IsPay,
    'PayAt'=>$this->PayAt,
    'PayType'=>$this->PayType,
    'Status'=>$this->Status,
    'IsSettle'=>$this->IsSettle,
    'UpdateAt'=>$this->UpdateAt,
    'channel'=>$this->channel,
    'IsShow'=>$this->IsShow,
    'CreateYmd'=>$this->CreateYmd,
    'PayYmd'=>$this->PayYmd,
    'ParentUserID'=>$this->ParentUserID,
    'IsRefund'=>$this->IsRefund,
    'NickID'=>$this->NickID,
    'ProductID'=>$this->ProductID,
    'TimeOut'=>$this->TimeOut,        ];
	}
}

class StoreOrderRow
{
	public StoreOrderColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'OrderID' => $this->data->OrderID,
        'UserID' => $this->data->UserID,
        'UseMoney' => $this->data->UseMoney,
        'UseRmbs' => $this->data->UseRmbs,
        'Price' => $this->data->Price,
        'CreateAt' => $this->data->CreateAt,
        'PayConfID' => $this->data->PayConfID,
        'PayBillID' => $this->data->PayBillID,
        'IsPay' => $this->data->IsPay,
        'PayAt' => $this->data->PayAt,
        'PayType' => $this->data->PayType,
        'Status' => $this->data->Status,
        'IsSettle' => $this->data->IsSettle,
        'UpdateAt' => $this->data->UpdateAt,
        'channel' => $this->data->channel,
        'IsShow' => $this->data->IsShow,
        'CreateYmd' => $this->data->CreateYmd,
        'PayYmd' => $this->data->PayYmd,
        'ParentUserID' => $this->data->ParentUserID,
        'IsRefund' => $this->data->IsRefund,
        'NickID' => $this->data->NickID,
        'ProductID' => $this->data->ProductID,
        'TimeOut' => $this->data->TimeOut, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new StoreOrderColumns();
        isset($data['OrderID']) && $this->data->OrderID = (string)$data['OrderID'];
           isset($data['UserID']) && $this->data->UserID = (int)$data['UserID'];
           isset($data['UseMoney']) && $this->data->UseMoney = (int)$data['UseMoney'];
           isset($data['UseRmbs']) && $this->data->UseRmbs = (int)$data['UseRmbs'];
           isset($data['Price']) && $this->data->Price = (int)$data['Price'];
           isset($data['CreateAt']) && $this->data->CreateAt = (int)$data['CreateAt'];
           isset($data['PayConfID']) && $this->data->PayConfID = (int)$data['PayConfID'];
           isset($data['PayBillID']) && $this->data->PayBillID = (int)$data['PayBillID'];
           isset($data['IsPay']) && $this->data->IsPay = (int)$data['IsPay'];
           isset($data['PayAt']) && $this->data->PayAt = (int)$data['PayAt'];
           isset($data['PayType']) && $this->data->PayType = (int)$data['PayType'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
           isset($data['IsSettle']) && $this->data->IsSettle = (int)$data['IsSettle'];
           isset($data['UpdateAt']) && $this->data->UpdateAt = (int)$data['UpdateAt'];
           isset($data['channel']) && $this->data->channel = (int)$data['channel'];
           isset($data['IsShow']) && $this->data->IsShow = (int)$data['IsShow'];
           isset($data['CreateYmd']) && $this->data->CreateYmd = (int)$data['CreateYmd'];
           isset($data['PayYmd']) && $this->data->PayYmd = (int)$data['PayYmd'];
           isset($data['ParentUserID']) && $this->data->ParentUserID = (int)$data['ParentUserID'];
           isset($data['IsRefund']) && $this->data->IsRefund = (int)$data['IsRefund'];
           isset($data['NickID']) && $this->data->NickID = (int)$data['NickID'];
           isset($data['ProductID']) && $this->data->ProductID = (int)$data['ProductID'];
           isset($data['TimeOut']) && $this->data->TimeOut = (int)$data['TimeOut'];
    }
}
?>